<template>
  <div class="home">

    <!-- 轮播图 -->
    <HomeSwipe />
    <!-- 列表 -->
    <ProductList :dataList="list" typeStyle="card" />
  </div>
</template>

<script>
import { Divider } from 'vant'
// import { share } from '../../util/wxUtils'

export default {
  name: 'defaultHome',
  components: {
    [Divider.name]: Divider,
    ProductList: () => import('@/components/ProdList.vue'),
    HomeSwipe: () => import('./components/HomeSwipe.vue')
  },
  data () {
    return {
      menusList: [], // 菜单宫格
      bannerShow: false,
      banner: {}, // 中部 底部 广告位
      couponInfo: {},
      showAdStatus: false,
      filterList: [],
      list: [{
        id: 1,
        title: '标题1标题1标题1标题1标题1标题1标题1标题1标题1标题1',
        desc: '描述描述描述描述11111111',
        link: '',
        status: 0,
        statusDesc: '进行中',
        imageUrl: 'https://game.img.ismartgo.cn/test/231017/0992a4f6-3fc9-4d2a-8657-615db6149462.png'
      },
      {
        id: 2,
        title: '标题1标题1标题1标题1标题1',
        desc: '描述描述描述描述11111111',
        link: '',
        status: 0,
        statusDesc: '进行中',
        imageUrl: 'https://game.img.ismartgo.cn/test/231017/0992a4f6-3fc9-4d2a-8657-615db6149462.png'
      },
      {
        id: 3,
        title: '标题1',
        desc: '描述描述描述描述11111111',
        link: '',
        status: 0,
        statusDesc: '进行中',
        imageUrl: 'https://game.img.ismartgo.cn/test/231017/0992a4f6-3fc9-4d2a-8657-615db6149462.png'
      }]
    }
  },
  computed: {
    reloadPage () {
      return this.$store.state.reloadPage
    }
  },
  watch: {
    $route (to, from) {
      // 如果优惠券弹出来的时候，从首页去了别的页面，就隐藏优惠券弹框
      if (to.name !== from.name && to.path !== '/home') {
        this.showAdStatus = false
      }
    }
  },
  methods: {

  },
  mounted () {
    // 储存 初始状态数据
    sessionStorage.setItem('data', JSON.stringify(this.$data))
  },
  destroyed () {
    this.$wx.miniProgram.getEnv(res => {
      if (res.miniprogram) {
        this.$wx.miniProgram.postMessage({
          data: {
            type: 'share',
            title: this.copyRight.title
          }
        })
      }
    })
  }
}
</script>

<style lang="less" scoped>
.home {
  width: 100vw;
  -webkit-overflow-scrolling: touch;
  background-color: #fff;
  .grid-swipe {
    padding-top: 12px;
    margin-bottom: 5px;
  }
  // banner
  .banner-top {
    margin: 0 16px;
    text-align: center;
    overflow: hidden;
    padding: 5px 0;
    img {
      max-width: 100%;
      height: auto;
    }
  }
  .banner-down {
    margin: 0 16px;
    text-align: center;
    border-radius: 10px;
    padding: 10px 0;
    img {
      max-width: 100%;
      height: auto;
    }
  }
}
.baiteng-home-bg {
  height: 100%;
  background: url('https://qnimg.zowoyoo.com/img/6474831/1655111835710.jpg') repeat-y;
  background-size: 100% 100%;
  .super-hot .hot-box {
    background-image: linear-gradient(180deg, transparent 2.13333rem, transparent 4.26667rem);
  }
}
</style>

<style lang="less">
.home {
  .van-tag {
    padding: 0 0.5em;
  }
  .swipe {
    .van-swipe__indicator {
      border-radius: 6px;
      background-color: rgba(255, 255, 255, 0.9);
    }
    .van-swipe__indicator--active {
      width: 20px;
      background-color: #ffffff;
    }
  }
  .baiteng-grid {
    .swipe-item>div span {
      font-size: 16px;
    }
  }
}

.baiteng-home-bg {
  .super-hot .hot-box {
    background-image: linear-gradient(180deg, transparent 2.13333rem, transparent 4.26667rem) !important;
  }
}
</style>
